<%@ page contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>五维两步中医健康状态评估问卷</title> 
<%@ include file="/app/evaluation/include.jsp"%> 
</head>
<body>
	<div class="wapBody">
		<table align="center" cellspacing="0" cellpadding="0">
			<TBODY>
				<tr>
					<td class="CorTop_L"></td>
					<td class="CorTop_Md">
						<div class="topMd">
							<H2>五维两步中医健康状态评估</H2>
						</div></td>
					<td class="CorTop_R"></td>
				</tr>
				<tr>
					<td class="CorMd_L CorMd_L1"></td>
					<!--只有填写题目页高度高所以添加样式CorMd_L1-->
					<td class="CorMd_Md">
						<div class="innerBody">
							<div class="topLbg">
								<div class="topRbg">
									<div class="stepNav step2">
										<ul>
											<li><A href="javascript:;">介绍说明</A></li>
											<li><A href="javascript:;">填写题目</A></li>
											<li><A href="javascript:;">结果</A></li>
										</ul>
									</div>
								</div>
								<!--topRbg 结束-->
							</div>
							<!--topLbg结束-->
							<div class="mcL_bg">
								<div class="mcR_bg">
									<div class="mc TiMuBox">
										<div class="test">
										<div class="test1" id="1_test">
												<div class="DiJIZu">
												     请选择你的性别：<B> <input type="radio" value="1" name="sex"/>男  <input type="radio" value="2" name="sex"/>女</B>
      	 											<div class="step-1"></div>
												</div>
												<div class="testCnt">
												    <ul class="JutiTiMu" id="yangxuzhi_ul">
														<li id="yangxuzhi_li_1">
														    总的来说，您对自己健康状况的评价是：
														  <input type="radio" name="answer1" value=1/>好<input type="radio" name="answer1" value=2/>差
														    
															<div class="clear"></div>
													    </li> 
													</ul> 
													 
													
												</div>
											 
											</div>
										</div>
										<!--介绍说明时隐藏链接上一组测试，按钮只显示下载一组测试。到最后一页时添加样式bn_chaKan显示查看结果按钮-->

										<div class="rsltBtn">
											<a id="a_up" href="javascript:void(0)">&gt;&gt; 上一组测试</a>
											<input class="bn_nextCeshi" id="a_next" type="button"/>
										</div>
										<div class="wanzheng">完整测试需9组题目，为了更准确的测出您的体质，请耐心进行</div>
									</div>
									<!--内容结束-->
								</div>
								<!--内容右背景结束-->
							</div>
							<!--内容左背景结束-->
							<div class="botLbg">
								<div class="botRbg"></div>
							</div>
							<!--声明结束-->
						</div></td>
					<td class="CorMd_R CorMd_R1"></td>
					<!--只有填写题目页高度高所以添加样式CorMd_R1-->
				</tr>
				<tr>
					<td class="CorBt_L"></td>
					<td class="CorBt_Md">
						<div class="btMd">
							声明：本工具所提供的结果以及分析建议等仅供参考。如有需要，请咨询相关医院和专家。<BR>
							<div style="height: 16px; overflow: hidden;">
								<div
									style="width: 360px; height: 16px; text-align: right; overflow: hidden; float: right;">
								</div>
							</div>
						</div></td>
					<td class="CorBt_R"></td>
				</tr>
			</TBODY>
		</table>
		<INPUT id="topic_num" type="hidden" value="1_test">
	</div>

	<script type="text/javascript">
var yangxuzhisum = 0; //阳虚质分数
var yinxuzhisum = 0; //阴虚质分数
var qixuzhisum = 0; //气虚质分数
var tanshizhisum = 0; //痰湿质分数
var shirezhisum = 0; //湿热质分数
var xuetanzhisum = 0; //血瘀质分数
var tebingzhisum = 0; //特禀质分数
var qiyuzhisum = 0; //气郁质分数
var pinghezhisum = 0; //平和质分数
var site='yeekang';
$(function() {
    var idstr = getCookie("tzpingce_id");
    //alert(idstr);
    if (idstr != undefined) {
        for (var i = 0; i < idstr.split('|').length; i++) {
            $("#" + idstr.split('|')[i]).attr("class", "s");
        }
        idstr = "";
    } else {
        $("b").each(function(b_css) {
            if ($(this).text() == "3") {
                this.className = "s";
            }
        });
        idstr = "";
    }
    $("li b").mouseout(function() {
        if (this.id != "") {
            if (this.className != "s") {
                this.className = "b1";
            }
        }
    });
    $("li b").mouseover(function() {

        if (this.id != "") {
            if (this.className != "s") {
                this.className = "b2";
            }
        }
    });
    $("li b").click(function() {
        if (this.id != "") {
            var ids = this.id.split('_');
            $("#" + ids[0] + "_" + ids[1] + "_" + ids[2] + " b").attr("class", "b1");
            this.className = "s";
        }
    });

    //上一个
    $("#a_up").click(function() {
        var value = parseInt($("#topic_num").val().split("_")[0]);
        if (value == 1) {
            alert("已经是第一组");
        } else {
            $("#" + $("#topic_num").val()).hide();
            $("#" + (value - 1) + "_test").show();
            $("#topic_num").attr("value", (value - 1) + "_test");
        }
        is_a_up();
    });

    //下一组
    $("#a_next").click(function() {
        var value = parseInt($("#topic_num").val().split("_")[0]);
        if (value == 9) {
            var num = 0; //判断是否答全
            var count = 0; //条目数
            var type = 0;
            var value = 0;
            $("ul[id$='_ul']").each(function(ul_index) {
                if (ul_index == 0) {
                    type = 1;
                }
                if (type == 1) {
                    $("#" + this.id + " li").each(function(li_index) {
                        count += 1;
                        $("#" + this.id + " b").each(function(b_index) {
                            
                            //判断是否为选中状态
                            if (this.className == "s") {
                                num += 1;
                                value += parseInt($(this).text());
                                idstr += this.id + "|";

                            }
                        });
                        if (num != count) {
                            type = 0;
                            alert("在" + conversion(this.id.split("_")[0]) + "中第" + this.id.split("_")[2] + "题未选择");
                            return false;
                        }
                    });
                    if (num == count) {
                        assignment(this.id.split("_")[0], value, count);
                        count = 0;
                        num = 0;
                        type = 1;//完成
                        value = 0;
                    }
                }
            });
            if (type == 1) {
                var outvalue = "yangxuzhi:" + yangxuzhisum + "|yinxuzhi:" + yinxuzhisum + "|qixuzhi:" + qixuzhisum + "|tanshizhi:" + tanshizhisum + "|shirezhi:" + shirezhisum + "|xuetanzhi:" + xuetanzhisum + "|tebingzhi:" + tebingzhisum + "|qiyuzhi:" + qiyuzhisum + "|pinghezhi:" + pinghezhisum;
                addCookie("tzpingce", outvalue, 1);
                addCookie("tzpingce_id", idstr, 1);
                
                window.location.href = '<%=basePath%>ha/phy/loadPhyEvaResult.do';

            }
        } else {
            $("#" + $("#topic_num").val()).hide();
            $("#" + (value + 1) + "_test").show();
            $("#topic_num").attr("value", (value + 1) + "_test");
        }
        is_a_up();
    });

    is_a_up();
});
function assignment(type, value, count) {
    switch (type) {
        case "yangxuzhi":
            yangxuzhisum = calculation(value, count);
            break;
        case "yinxuzhi":
            yinxuzhisum = calculation(value, count);
            break;
        case "qixuzhi":
            qixuzhisum = calculation(value, count);
            break;
        case "tanshizhi":
            tanshizhisum = calculation(value, count);
            break;
        case "shirezhi":
            shirezhisum = calculation(value, count);
            break;
        case "xuetanzhi":
            xuetanzhisum = calculation(value, count);
            break;
        case "tebingzhi":
            tebingzhisum = calculation(value, count);
            break;
        case "qiyuzhi":
            qiyuzhisum = calculation(value, count);
            break;
        case "pinghezhi":
            pinghezhisum = calculation(value, count);
            break;
        default:
            break;
    }
}
</script>

<script src="<%=basePath %>app/evaluation/js/app.iframeset.min.js"  type="text/javascript"></script>

<script type="text/javascript">
		/**app.iframeset.init({
			'applink':'http://jkcp.yeekang.com/zytz/',
			'appsrc':'zytz',
			'appclass':',21,',
			'platform':'直接访问',
			'autoheight':1,
			'autourl':'http://jkcp.yeekang.com/js/tool_server-1.0.htm',
			'width':540
		});
		*/
</script>
</body>
</html>
